package scau.markmapscau.Model.Node;

import java.io.Serializable;
import java.util.LinkedList;

public class Node implements Serializable {
    /*数据域*/
    private int id;//1.该节点的唯一标识号
    private int parentId;//2.该节点所对应的父节点的编号
    private int depth;//3.节点的深度,也就是节点在图中的层级

    private double nodeLocationX;//节点的中心坐标点的X坐标
    private double nodeLocationY;//节点的中心坐标点的Y坐标
    private double nodeHeight;//节点高度
    private double nodeWidth;//节点宽度
    private String content;//节点内文本内容

    private boolean isChose;//是否被选中
    private boolean isTraverse;//是否遍历

    private LinkedList<Integer> sonNodeList;

    private double nodeBlockWidth;//节点所在块的宽度
    private double nodeBlockHeight;//节点所在块的高度

    private boolean isDrawedAllChildren = false;//是否将所有的子节点画完了

    private String color="#ffffff";//节点颜色
    private String style="FangSong";//字体节点样式
    private int size;//字体大小

    private int counter=0;

    /*方法域*/
    /*初始化由外部管理者完成,给予节点唯一的id号*/
    public Node(int id,double nodeWidth,double nodeHeight,String color,String style){
        this.id = id;
        this.content ="新建节点";
        this.nodeWidth = nodeWidth;
        this.nodeHeight = nodeHeight;
        this.style = style;
        this.color = color;
        this.sonNodeList = new LinkedList<>();
        this.isChose = false;
        this.isTraverse=false;
        this.size = 17;
    }

    /*接下来的部分是set和get部分*/
    /*id只有访问器而无修改器*/
    public int getId(){return this.id;}

    /*color*/
    public String getColor() {return color;}
    public void setColor(String color) {this.color = color;}

    /*style*/
    public String getStyle() {return style;}
    public void setStyle(String style) {this.style = style;}

    /*size*/
    public int getSize() {return size;}
    public void setSize(int size) {this.size = size;}

    /*parentId*/
    public int getParentId(){return this.parentId;}
    public void setParentId(int parentId){this.parentId = parentId;}

    /*depth*/
    public int getDepth(){return this.depth;}
    public void setDepth(int depth){this.depth = depth;}

    /*nodeLocationX*/
    public double getNodeLocationX(){return this.nodeLocationX;}
    public void setNodeLocationX(double nodeLocationX){this.nodeLocationX = nodeLocationX;}

    /*nodeLocationY*/
    public double getNodeLocationY(){return this.nodeLocationY;}
    public void setNodeLocationY(double nodeLocationY){this.nodeLocationY = nodeLocationY;}

    /*nodeHeight*/
    public double getNodeHeight(){return this.nodeHeight;}
    public void setNodeHeight(double nodeHeight){this.nodeHeight = nodeHeight;}

    /*nodeWidth*/
    public double getNodeWidth(){return this.nodeWidth;}
    public void setNodeWidth(double nodeWidth){this.nodeWidth = nodeWidth;}

    /*content*/
    public String getContent(){return this.content;}
    public void setContent(String content){this.content = content;}

    /*sonNodeList*/
    public LinkedList<Integer> getSonNodeList(){return this.sonNodeList;}
    public void setSonNodeList(){this.sonNodeList = sonNodeList;}

    /*isChose*/
    public boolean isChose(){return isChose;}
    public void setIsChose(boolean isChose){this.isChose = isChose;}

    /*isTraverse*/
    public boolean isTraverse() {return isTraverse;}
    public void setIsTraverse(boolean isTraverse){this.isTraverse=isTraverse;}

    /*NodeBlockHeight*/
    public double getNodeBlockHeight() {return nodeBlockHeight;}
    public void setNodeBlockHeight(double nodeBlockHeight){this.nodeBlockHeight = nodeBlockHeight;}

    /*nodeBlockWidth*/
    public double getNodeBlockWidth() {return nodeBlockWidth;}
    public void setNodeBlockWidth(double nodeBlockWidth) {this.nodeBlockWidth = nodeBlockWidth;}

    /*isDrawedAllChildren*/
    public boolean isDrawedAllChildren() {return isDrawedAllChildren;}
    public void setIsDrawedAllChildren(boolean isDrawedAllChildren){this.isDrawedAllChildren = isDrawedAllChildren;}

    public int getCounter() {return counter;}

    public void setCounter(Integer counter) {this.counter = counter;}

    @Override
    public String toString(){
        return "id:"+this.getId()+
                ",X:"+this.getNodeLocationX()+
                ",Y:"+this.getNodeLocationY()+
                ",nodeBlockHeigh:"+this.getNodeBlockHeight()+
                ",nodeBlockWidth:"+this.getNodeBlockWidth()+
                ",color:"+this.getColor()+
                ",style:"+this.getStyle()+
                ",isChose:"+this.isChose()+
                ",isDrawedAllChildren:"+this.isDrawedAllChildren;
    }
}
